/*
 * memory.h
 *
 *  Created on: Mar 4, 2012
 *
 * shared global memory locations (which can hold simple ints) should behave a mutex.  and thus
	can be used to synchronize the Inter-process-communication between two processes.  The memory locations can be initialized
	when the simulation starts and be known to all processes in advance.

* Notes
* Initialized on start
* Shared by all processes
* Uses mutex to control access
*
*/

#ifndef MEMORY_H_
#define MEMORY_H_

typedef struct {
	int size;
	// this isn't REAL memory...
		/*
		 *	getLocation(int the_location)
		 *		get lock
		 *		store value into var
		 *		release lock
		 *		return var
		 */
		//int (*getLocation)(void *, int location);
		/*
		 *	setLocation(int)
		 *		get lock
		 *		modify data
		 *		release lock
		 *		return
		 */
		//int (*setLocation)(void *, int location, int value);

	int (*up)(void *, int location);
	int (*down)(void *, int location);
	int (*check_location)(void *, int location);
	int * shared_memory;

} memory;

memory * memory_init(int size);



#endif /* MEMORY_H_ */
